package com.kaifamiao.demo.d0823;

// 导入类 A
import com.kaifamiao.demo.d0823.test.A;

// 静态导入
import java.util.Random;
import java.util.Scanner;

import static com.kaifamiao.demo.d0823.test.A.num;
import static com.kaifamiao.demo.d0823.test.A.say;

public class Demo {

    public static void main(String[] args) {
        /*
            同包下的类 不用导包
            java.lang.* 不用导包
                String System Object Math Exception Interger Character Long Short
            静态导入:
                `import static `静态导入其他类的`static`成员。然后就可以省略类名直接调用
         */
        System.out.println(num);
        say();

        System.out.println(Math.PI);

        System.out.println(Math.cbrt(27));
        System.out.println(Math.sqrt(4));


        System.out.println(Math.ceil(3.000));
        System.out.println(Math.ceil(3.0001));
        System.out.println(Math.ceil(3.999));

        System.out.println(Math.floor(3.000));
        System.out.println(Math.floor(3.0001));
        System.out.println(Math.floor(3.999));

        // 四舍五入
        System.out.println(Math.round(3.5));


        System.out.println(Math.fma(3.1, 3.2, 4));
        System.out.println(3.1 * 3.2);

        System.out.println(Math.negateExact(-10));

        System.out.println(Math.pow(2, 3)); // 2^3

        // 0 ~ 1
        System.out.println(Math.random());

        Random random = new Random();
//        random.nextInt()
        System.out.println(random.nextInt(5));
    }
}

